home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / oop_tp55.zip / LIST5_1.PAS < prev    next >
Pascal/Delphi Source File  |  1990-02-01  |  697b  |  41 lines

  1. program Listing5_1;
  2.  
  3. type
  4.  
  5. Elf = object
  6.       Name : string;
  7.       constructor Init( Monicker : string );
  8.       procedure ShopScript; 
  9.       procedure GoShopping;
  10.       end;
  11.  
  12. constructor Elf.Init( Monicker : string );
  13. begin
  14.      Name := Monicker;
  15. end;
  16.  
  17. procedure Elf.ShopScript;
  18. begin
  19.      writeln( '<Door slams as ', Name, ' leaves>');
  20.      writeln( '<long pause.......>' );
  21.      writeln( '<Door slams as ', Name, ' returns>');
  22.      writeln( Name, ': I went to the store and bought milk and eggs.');
  23. end;
  24.  
  25. procedure Elf.GoShopping;
  26. begin
  27.      ShopScript;
  28. end;
  29.  
  30.  
  31. var
  32.    Jay : Elf;
  33.  
  34. begin
  35.      Jay.Init( 'JAY' );
  36.  
  37.      Jay.GoShopping;
  38. end.
  39.  
  40. { Listing 5-1 }
  41.